/*
 * $Id: Spec.java 23 2002-09-29 13:59:30Z bpruessmann $
 * 
 * Copyright (c) 2001 Boris Pruessmann and others.
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Common Public License v0.5
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v05.html
 * 
 * Contributors:
 *    Boris Pruessmann - Initial implementation.
 */
package net.sourceforge.p4eclipse.core.api;

/**
  * Wrapper class for Perforce API Spec class.
  * 
  * @version	$Revision: 23 $
  * @author 	<a href="mailto:bpruessmann@users.sourceforge.net">Boris Pruessmann</a>
  */
public class Spec
{
	/* DON'T TOUCH THE CONTENT OF THIS VARIABLE */
	private int _nativeHandle;

	/** Creates a new Client instance. */
	public Spec()
	{
		construct();
	}
	
	/** @see Object#finalize() */
	public void finalize() 
		throws Throwable
	{
		super.finalize();
		destruct();
	}

	/*
	 * Called by the constructor to initialize the native side
	 * of this class.
	 */
	private native void construct();
	
	/*
	 * Called by finalize() to destroy the native side of this
	 * class.
	 */
	private native void destruct();

	/** Wrapper for Spec::Decode. 
	  * decode a spec definition from a string.
	  */
	public native void decode(String specDefString, PerforceError error);

	/** Wrapper for Spec::Format. 
	  * turn SpecData into a spec string.
	  */
	public native String format(SpecData data);
	
	/** Wrapper for Spec::Parse. 
	  * parse a spec string into SpecData.
	  */
	public native void parse(String specString, SpecData data, PerforceError error, int valid);

}
